package com.jinyijia.api.rest.v1.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Optional;

/**
 * @author WX
 * @date 2018/8/7
 **/
@Data
@AllArgsConstructor
public class CategoryVO implements Comparable<CategoryVO>{
    private Integer id;
    private String name;
    private Integer sort;

    @Override
    public int compareTo(CategoryVO o) {
        return Optional.ofNullable(this.getSort()).orElse(0).compareTo(Optional.ofNullable(o.getSort()).orElse(0));
    }

}
